package com.amitshekhar.utils

import com.amitshekhar.DebugDB
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.runBlocking

/**
 * Author:Wang Xiaolong, 2022/3/15 11:11
 */
object DataStoreHelper {

    @JvmStatic
    fun getAllData(name: String) = runBlocking {
        DebugDB.dataStoreMap?.get(name)?.data?.map {
            it.asMap().mapKeys { it.key.name }
        }?.first() ?: emptyMap()
    }

}